
*********************************************
****   Description   ************************
*********************************************

*This program generates "Figure 2. Volumes of Loans Issued by the Freedman's Savings Bank and Defaulted – Before and After the 1870 Charter Amendment" from our dataset of Freedman's Savings Bank loans. 


**********************************************************************
****  Plot  ******************
**********************************************************************
use "$Data/Loan_Database_December2024.dta", clear

* keep if month and face value non-missing 
gen month=mofd(issue_date)
format month %tm 
drop if month ==. 
drop if facevalue == . 

* generate time variables
gen year = yofd(issue_date)
gen quarter = qofd(issue_date)
format quarter %tqCCYY!Qq

* collapse 
collapse (sum) total_amount=facevalue unrepaid_amount=fv_less_repay  , by(quarter)
gen unrepaid_amount_quarter_share = unrepaid_amount/total_amount

* graph
twoway  (bar total_amount unrepaid_amount  quarter) /// 
(scatteri 0 -360 500000 -360  , recast(line) lwidth(thick) lpattern(solid) color(black)) , ///
legend(order(1  "")) ///
ylabel(,nogrid) ylabel(, format(%12.0fc)) ///
legend(region(col(white))) ///
bgcolor(white) graphregion(color(white)) plotregion(fcolor(white)) ///
ytitle("Dollars") ///
legend(order(1 "Issued Amount" 2 "Defaulted Amount"))  legend( region(lstyle(none)) ) 

